/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Merlion.userManagement.entity;

import Merlion.userManagement.entity.SystemUserEntity;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;

@Entity
public class MessageEntity implements Serializable {
   
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String senderId;
    private String senderName;
    private List<String> receiverId;
    private List<String> receiverName;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dateCreated;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dateRead;
    private String title;
    @Column(length = 32600)
    private String body;
    private boolean received;
    private boolean readByUser;
    private String deleteFlag;
    private String starred;
    @OneToMany
    private List<SystemUserEntity> systemUserList;
    
    public void create(String senderId,List<String> receiverId, List<String> receiverName, Date dateCreated, String title, String body){
        
        this.setId(id);
        this.setSenderId(senderId);
        this.setReceiverId(receiverId);
        this.setReceiverName(receiverName);
        this.setDateCreated(dateCreated);
        this.setTitle(title);
        this.setBody(body);
        this.setReceived(false);
        this.setDeleteFlag("N");
        this.setStarred("N");
    }
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getBody() {
        return body.replace("\n", "<br />");
    }

    public void setBody(String body) {
        this.body = body;
    }

    public Date getDateCreated() {
        return dateCreated;
    }

    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }

    public Date getDateRead() {
        return dateRead;
    }

    public void setDateRead(Date dateRead) {
        this.dateRead = dateRead;
    }

    public boolean isReceived() {
        return received;
    }

    public void setReceived(boolean received) {
        this.received = received;
    }

    public List<String> getReceiverId() {
        return receiverId;
    }

    public void setReceiverId(List<String> receiverId) {
        this.receiverId = receiverId;
    }

    public List<String> getReceiverName() {
        return receiverName;
    }

    public void setReceiverName(List<String> receiverName) {
        this.receiverName = receiverName;
    }  

    public String getSenderName() {
        return senderName;
    }

    public void setSenderName(String senderName) {
        this.senderName = senderName;
    }

    
    
    public String getSenderId() {
        return senderId;
    }

    public void setSenderId(String senderId) {
        this.senderId = senderId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }


    public String getDeleteFlag() {
        return deleteFlag;
    }

    public void setDeleteFlag(String deleteFlag) {
        this.deleteFlag = deleteFlag;
    }

    public String getStarred() {
        return starred;
    }

    public void setStarred(String starred) {
        this.starred = starred;
    }

    public boolean isReadByUser() {
        return readByUser;
    }

    public void setReadByUser(boolean readByUser) {
        this.readByUser = readByUser;
    }
    
    

    
}
